/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Views.Base;

import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

/**
 *
 * @author Joshua King
 */
public abstract class BaseViewLoginUser extends JPanel{
    
    private final int MAXCHAR = 10;
    private JPanel loginPanel = new JPanel();
    private JTextField userField = new JTextField(MAXCHAR);
    private JPasswordField passwordField = new JPasswordField(MAXCHAR);
    protected JButton loginButton = new JButton("Login");
    protected boolean isRunning = false;

    public BaseViewLoginUser() {
        this.add(loginPanel);
        loginPanel.add(userField);
        loginPanel.add(passwordField);
        loginPanel.add(loginButton);
        loginPanel.setLayout(new FlowLayout());
        
        passwordField.setEchoChar('*');
        this.setVisible(true);
    }

    /**
     * gets the password field
     * @return
     */
    public String getPasswordField() {
        System.out.println(passwordField.getPassword());
        return (new String(passwordField.getPassword()));
    }

    /**
     * gets the user field
     * @return
     */
    public String getUserField() {
        return userField.getText();
    }
    
    public void resetDataFields() {
        userField.setText("");
        passwordField.setText("");
    }
}
